package fsesl

import "time"

const (
	EventName                 = "Event-Name"
	EventSubclass             = "Event-Subclass"
	NameChannelCreate         = "CHANNEL_CREATE"          // 新通道创建（通话请求到来）
	NameChannelState          = "CHANNEL_STATE"           // 通道状态变化 呼叫状态监控
	NameChannelProgress       = "CHANNEL_PROGRESS"        //被叫方收到呼叫请求（如回铃音）
	NameChannelAnswer         = "CHANNEL_ANSWER"          // 被叫应答通话
	NameChannelBridge         = "CHANNEL_BRIDGE"          // 两条通话通道（A/B腿）桥接成功
	NameChannelHangup         = "CHANNEL_HANGUP"          // 通话结束（挂机）
	NameChannelHangupComplete = "CHANNEL_HANGUP_COMPLETE" // 通话完全结束（资源释放）
	NameChannelDestroy        = "CHANNEL_DESTROY"         // 通道资源释放
	NameCustom                = "CUSTOM"
	NamePublish               = "PUBLISH"
	NameUnPublish             = "UNPUBLISH"
	HeaderFromHost            = "from-host"
	HeaderVertoProfileName    = "verto_profile_name"
	HeaderVertoLogin          = "verto_login"
	HeaderVertoSuccess        = "verto_success"
	HeaderFromUser            = "from-user"
	HeaderHost                = "host"
	HeaderUser                = "user"
	HeaderStatus              = "status"
	HeaderProfileName         = "profile_name"
	HeaderProfileNameDash     = "profile-name"
	HeaderProfileUri          = "profile_uri"
	HeaderGateway             = "Gateway"
	HeaderState               = "State"
	NameCSGatewayAdd          = "CUSTOM sofia::gateway_add"
	NameCSGatewayDelete       = "CUSTOM sofia::gateway_delete"
	NameCSGatewayState        = "CUSTOM sofia::gateway_state"
	NameSubGatewayAdd         = "sofia::gateway_add"
	NameSubGatewayDelete      = "sofia::gateway_delete"
	NameSubGatewayState       = "sofia::gateway_state"
	NameCSRegister            = "CUSTOM sofia::register"
	NameCSUnregister          = "CUSTOM sofia::unregister"
	NameCSExpire              = "CUSTOM sofia::expire"
	NameCSInfo                = "CUSTOM sofia::info"
	NameCVClientConnect       = "CUSTOM verto::client_connect"
	NameCVClientDisconnect    = "CUSTOM verto::client_disconnect"
	NameCVLogin               = "CUSTOM verto::login"
	NameCCallcenter           = "CUSTOM callcenter::info"
	NameModuleLoad            = "MODULE_LOAD"
	NameModuleUnload          = "MODULE_UNLOAD"
	NameName                  = "name"
	NameKey                   = "key"

	// NameChannelUuid              = "Channel-Call-UUID"
	NameChannelUuid                  = "Unique-ID"
	NameChannelDirection             = "Call-Direction"
	NameChannelDate                  = "Event-Date-Local"
	NameChannelCreatedEpoch          = "Caller-Channel-Created-Time"
	NameChannelName                  = "variable_channel_name"
	NameChannelCallerName            = "Caller-Caller-ID-Name"
	NameChannelCallerNumber          = "Caller-Caller-ID-Number"
	NameChannelCallerIp              = "Caller-Network-Addr"
	NameChannelCallerDest            = "Caller-Destination-Number"
	NameChannelPresenceId            = "Channel-Presence-ID"
	NameChannelPresenceData          = "Channel-Presence-Data"
	NameChannelAccountcode           = "variable_accountcode"
	NameChannelCallState             = "Channel-Call-State"
	NameChannelCallUuid              = "variable_call_uuid"
	NameChannelHostname              = "FreeSWITCH-Hostname"
	NameChannelOtherLegUuid          = "Other-Leg-Unique-ID"
	NameChannelCalleeIdName          = "Caller-Callee-ID-Name"
	NameChannelCalleeIdNumber        = "Caller-Callee-ID-Number"
	NameChannelApplication           = "variable_current_application"
	NameChannelApplicationData       = "variable_current_application_data"
	NameChannelDialplan              = "Caller-Dialplan"
	NameChannelContext               = "Caller-Context"
	NameChannelReadCodec             = "Channel-Read-Codec-Name"
	NameChannelReadCodecRate         = "Channel-Read-Codec-Rate"
	NameChannelReadCodecBitRate      = "Channel-Read-Codec-Bit-Rate"
	NameChannelWriteCodec            = "Channel-Write-Codec-Name"
	NameChannelWriteCodecRate        = "Channel-Write-Codec-Rate"
	NameChannelWriteCodecBitRate     = "Channel-Write-Codec-Bit-Rate"
	NameCallerChannelAnswerTIme      = "Caller-Channel-Answered-Time"
	NameCallcenterAction             = "CC-Action"
	NameCallcenterAgent              = "CC-Agent"
	NameCallcenterAgentStatus        = "CC-Agent-Status"
	NameCallcenterAgentState         = "CC-Agent-State"
	NameCallcenterQueue              = "CC-Queue"
	NameCallcenterMemberUuid         = "CC-Member-UUID"
	NameCallcenterMemberSessionUuid  = "CC-Member-Session-UUID"
	NameCallcenterMemberCIDName      = "CC-Member-CID-Name"
	NameCallcenterMemberCIDNumber    = "CC-Member-CID-Number"
	VariableCCQueueJoinedEpoch       = "variable_cc_queue_joined_epoch"
	NameCallcenterMemberAnsweredTime = "CC-Agent-Answered-Time"
	NameEventDateTimestamp           = "Event-Date-Timestamp"

	CommandModuleExists     = "module_exists"
	CommandGlobalGetVar     = "global_getvar"
	CommandSwitchname       = "switchname"
	ValueChannelStateActive = "ACTIVE"

	CCMemberStateUnknown   = "unknown"
	CCMemberStateWaiting   = "waiting"
	CCMemberStateTrying    = "trying"
	CCMemberStateAnswered  = "answered"
	CCMemberStateAbandoned = "abandoned"
)

type regsAsJson struct {
	Registrations []Regs `json:"rows"`
	RowCount      int    `json:"row_count"`
}

type Regs struct {
	RegUser     string `json:"reg_user"`
	Realm       string `json:"realm"`
	Token       string `json:"token"`
	Url         string `json:"url"`
	Expires     string `json:"expires"`
	NetworkIp   string `json:"network_ip"`
	NetworkPort string `json:"network_port"`
	Hostname    string `json:"hostname"`
	Metadata    string `json:"metadata"`
}

type LogType struct {
	Created     time.Time `json:"created"`
	LogFile     string    `json:"log_file"`
	LogFunc     string    `json:"log_func"`
	LogLine     int       `json:"log_line"`
	LogLevel    int       `json:"log_level"`
	TextChannel int       `json:"text_channel"`
	UserData    string    `json:"user_data"`
	Body        string    `json:"body"`
}

type Channel struct {
	Uuid            string `json:"uuid"`
	Direction       string `json:"direction"`
	Created         string `json:"created"`
	CreatedEpoch    string `json:"created_epoch"`
	Name            string `json:"name"`
	State           string `json:"state"`
	CidName         string `json:"cid_name"`
	CidNum          string `json:"cid_num"`
	IpAddr          string `json:"ip_addr"`
	Dest            string `json:"dest"`
	Application     string `json:"application"`
	ApplicationData string `json:"application_data"`
	Dialplan        string `json:"dialplan"`
	Context         string `json:"context"`
	ReadCodec       string `json:"read_codec"`
	ReadRate        string `json:"read_rate"`
	ReadBitRate     string `json:"read_bit_rate"`
	WriteCodec      string `json:"write_codec"`
	WriteRate       string `json:"write_rate"`
	WriteBitRate    string `json:"write_bit_rate"`
	Secure          string `json:"secure"`
	Hostname        string `json:"hostname"`
	PresenceId      string `json:"presence_id"`
	PresenceData    string `json:"presence_data"`
	Accountcode     string `json:"accountcode"`
	Callstate       string `json:"callstate"`
	CalleeName      string `json:"callee_name"`
	CalleeNum       string `json:"callee_num"`
	CalleeDirection string `json:"callee_direction"`
	CallUuid        string `json:"call_uuid"`
	SentCalleeName  string `json:"sent_callee_name"`
	SentCalleeNum   string `json:"sent_callee_num"`
	InitialCidName  string `json:"initial_cid_name"`
	InitialCidNum   string `json:"initial_cid_num"`
	InitialIpAddr   string `json:"initial_ip_addr"`
	InitialDest     string `json:"initial_dest"`
	InitialDialplan string `json:"initial_dialplan"`
	InitialContext  string `json:"initial_context"`
}
